<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学习vue</title>
    <script src="../js/vue.js"></script>
    <style>
        *{
            padding: 12px;
        }
    </style>
</head>
<body>
    <div id="root">
        <button @click="updatef1">更新f1</button>
        <div v-for="p in persons" :key="p.id">
            {{p.name}} -- {{p.age}}
        </div>
    </div>
    <script>
        Vue.config.productionTip = false
        new Vue({
            el:'#root',
            data:{
                persons:[
                    {id:'001',name:"f1",age:30},
                    {id:'002',name:"z2",age:20},
                    {id:'003',name:"p3",age:50},
                    {id:'004',name:"ffff1",age:31},
                    {id:'005',name:"fzzzz2",age:21},
                    {id:'006',name:"fzzzzzz3",age:51},
                ],
            },
            methods:{
                updatef1(){
                    //这种改法，vue是检测不到的。
                    persons[0] = {id:'001',name:"f999",age:50}
                }
            }
        })
    </script>    
</body>
</html>